package biz;

import dao.AdminMapper;
import org.apache.ibatis.session.SqlSession;
import pojo.Admin;
import util.SqlSessionFactoryUtil;

public class AdminService {
    SqlSession session = SqlSessionFactoryUtil.getSqlSession();
    AdminMapper adminMapper = session.getMapper(AdminMapper.class);

    /**
     * 添加用户服务
     *
     * @param admin
     * @return
     */
    public int addAdmin(Admin admin) {
        int flag = adminMapper.addAdmin(admin);
        session.commit();
        return flag;
    }

    /**
     * 登陆用户服务
     *
     * @param admin
     * @return
     */
    public Admin loginAdmin(Admin admin) {
        return adminMapper.loginAdmin(admin);

    }

}
